package lsl.leetCode.year2023.test0203;

/**
 * description:
 *
 * @author: liushengli
 * data: 2023/2/3
 */
public class offer05 {
    public static void main(String[] args) {
        String s = "We are happy.";
        replaceSpace(s);
    }

    public static String replaceSpace(String s) {
        StringBuilder builder = new StringBuilder();
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) != 32) {
                builder.append(s.charAt(i));
            } else {
                builder.append("%20");
            }
        }
        return String.valueOf(builder);
    }
}
